if count(the pPackageFruitList of gPackageObj) = 0 then
exit
end if
set gRandomPos to random(count(the pPackageFruitList of gPackageObj))
EvaluateFruit()
end
on AnimatePackage
puppetSnd(1, 85)
updateStage()
repeat while soundBusy(1)
end repeat
repeat with n = 1 to 2
set the memberNum of sprite 35 to 16 + n
set vTicks to the ticks + 7
repeat while the ticks < vTicks
updateStage()
end repeat
end repeat
set the memberNum of sprite 35 to 16
updateStage()
end
on EvaluateFruit
if the memberNum of sprite 30 <> gNullCst then
ReturnFruitToPackage()
AnimatePackage()
SlideFruitToStartPos()
else
AnimatePackage()
SlideFruitToStartPos()
end if
end
on SlideFruitToStartPos
set the memberNum of sprite 30 to getAt(the pPackageFruitList of gPackageObj, gRandomPos)
slide(30, 41, 44, 4, 3)
end
on ClickRollUp
if gCompletedRollUp = 0 then
if gFruitRolledOut = 1 then
SlideClosedRollUps()
RollFruit()
end if
set vRollover to rollOver()
if (vRollover > 9) and (vRollover < 20) then
set gRolloverSpt to vRollover
SlideClosedRollUps()
UnRollRollUp()
PlaceRollUpPieces()
repeat while soundBusy(1)
end repeat
if the memberNum of sprite 30 <> gNullCst then
set vRollupPieceList to getProp(the pFruitCarpetFullList of gFruitObj, the memberNum of sprite gRolloverSpt)
if getPos(vRollupPieceList, getAt(the pPackageFruitList of gPackageObj, gRandomPos)) > 0 then
FruitMatch()
AnimateFruitToRollup()
repeat while soundBusy(1)
end repeat
puppetSnd(1, 86)
set the memberNum of sprite 40 to gGuyStandingCst
updateStage()
repeat while soundBusy(1)
end repeat
if gCompletedRollUp = 1 then
puppetSnd(1, 89)
updateStage()
repeat while soundBusy(1)
end repeat
puppetSnd(1, 87)
updateStage()
AnimateCompletedRollup()
repeat while soundBusy(1)
end repeat
puppetSnd(1, 90)
updateStage()
else
SlideClosedRollUps()
RollFruit()
end if
else
FruitReturn()
ReturnFruitToPackage()
SlideClosedRollUps()
RollFruit()
end if
end if
end if
end if
end
on SlideClosedRollUps
case gRolloverSpt of
10:
slide2(11, 12, the locV of sprite 11, 20, the locV of sprite 12, 20, 4, 3)
11:
slide2(10, 12, the locV of sprite 10, -20, the locV of sprite 12, 20, 4, 3)
12:
slide2(10, 11, the locV of sprite 10, -20, the locV of sprite 11, -20, 4, 3)
end case
end
on UnRollRollUp
puppetSnd(1, 82)
updateStage()
set gFruitRolledOut to 1
set the visible of sprite gRolloverSpt to 0
updateStage()
set the memberNum of sprite gUnRolledRollUpSpt to the memberNum of sprite gRolloverSpt + 1
set the loc of sprite gUnRolledRollUpSpt to the loc of sprite gRolloverSpt
updateStage()
wait(5)
end
on PlaceRollUpPieces vFruitPropList, vFruitLocPropList
set vFruitPropList to getProp(the pCarpetStatusList of gFruitObj, the memberNum of sprite gRolloverSpt)
set vFruitLocPropList to getProp(the pCarpetLocList of gFruitObj, the memberNum of sprite gRolloverSpt)
repeat with n = 1 to 4
if getAt(vFruitPropList, n) = 0 then
set the memberNum of sprite (19 + n) to gNullCst
set the loc of sprite (19 + n) to point(-1, -1)
next repeat
end if
set the memberNum of sprite (19 + n) to getAt(vFruitPropList, n)
set the loc of sprite (19 + n) to getAt(vFruitLocPropList, n)
end repeat
set the memberNum of sprite gUnRolledRollUpSpt to the memberNum of sprite gRolloverSpt + 2
updateStage()
end
on FruitMatch
puppetSnd(1, 93)
updateStage()
repeat while soundBusy(1)
end repeat
set the memberNum of sprite 40 to gGuyStandingCst + 1
updateStage()
set vFruitRollupAssignment to getPos(getProp(the pFruitCarpetFullList of gFruitObj, the memberNum of sprite gRolloverSpt), getAt(the pPackageFruitList of gPackageObj, gRandomPos))
set vFruitPropList to getProp(the pCarpetStatusList of gFruitObj, the memberNum of sprite gRolloverSpt)
set vFruitLocPropList to getProp(the pCarpetLocList of gFruitObj, the memberNum of sprite gRolloverSpt)
deleteAt(vFruitPropList, vFruitRollupAssignment)
addAt(vFruitPropList, vFruitRollupAssignment, 0)
set vMatchCount to 0
repeat with n = 1 to 4
if getAt(vFruitPropList, n) = 0 then
set vMatchCount to vMatchCount + 1
end if
end repeat
if vMatchCount = 4 then
set gCompletedRollUp to 1
end if
end
on AnimateFruitToRollup
set vFruitLocPropList to getProp(the pCarpetLocList of gFruitObj, the memberNum of sprite gRolloverSpt)
set vFruitRollupAssignment to getPos(getProp(the pFruitCarpetFullList of gFruitObj, the memberNum of sprite gRolloverSpt), getAt(the pPackageFruitList of gPackageObj, gRandomPos))
wait(60)
updateStage()
set vFruitH to getAt(getAt(vFruitLocPropList, vFruitRollupAssignment), 1)
set vFruitV to getAt(getAt(vFruitLocPropList, vFruitRollupAssignment), 2)
puppetSnd(1, 84)
updateStage()
AdjustSign(vFruitH, vFruitV)
puppetSound(0)
updateStage()
set the memberNum of sprite 30 to gNullCst
set the loc of sprite 30 to gFruitInPackageLoc
set the memberNum of sprite (19 + vFruitRollupAssignment) to gNullCst
set the loc of sprite (19 + vFruitRollupAssignment) to point(-1, -1)
deleteAt(the pPackageFruitList of gPackageObj, gRandomPos)
set gRandomPos to 0
end
on AdjustSign vFruitH, vFruitV
case gRolloverSpt of
10:
sinSlideUnder(30, vFruitH, vFruitV, 10, 2, 3)
11:
sinSlideUnder(30, vFruitH, vFruitV, 10, 2, 30)
12:
sinSlideUnder(30, vFruitH, vFruitV, 10, 2, 60)
end case
end
on RollFruit
if gFruitRolledOut = 1 then
puppetSnd(1, 83)
updateStage()
set the memberNum of sprite gUnRolledRollUpSpt to gNullCst
set the loc of sprite gUnRolledRollUpSpt to point(-1, -1)
repeat with n = 1 to 4
set the memberNum of sprite (19 + n) to gNullCst
set the loc of sprite (19 + n) to point(-1, -1)
end repeat
set the visible of sprite gRolloverSpt to 1
set the memberNum of sprite gRolloverSpt to getAt(getProp(the pFruitCarpetSptOrder of gFruitObj, gRolloverSpt), 1) + 1
updateStage()
wait(5)
set the memberNum of sprite gRolloverSpt to getAt(getProp(the pFruitCarpetSptOrder of gFruitObj, gRolloverSpt), 1)